<?php
namespace frontend\controllers;

use Yii;
use yii\web\Controller;
use common\models\WechatLogin;

class UserController extends APIController
{
// 	允许外部提交
	public $enableCsrfValidation = false;
    /**
     * Logs in a user.
     *
     * @return mixed
     */
    public function actionLogin()
    {

        $model = new WechatLogin();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
        	$this->json(\yii\helpers\ArrayHelper::toArray($model->login()), 1000, '登录成功');
        } else {
        	$this->json([], 404, '登录失败');
        }
    }
}
